#pragma once
#include <d3d9.h>
#include <d3dx9tex.h>
#include <string>

 struct TextData {
	int fontIndex;
	int colorIndex;
	RECT rect;
	int alignment;

	TextData() {
		fontIndex = -1;
		colorIndex = -1;
	}
  };
 
 struct ImageData {
	int spriteIndex;
	int colorIndex;
	int left;
	int top;
	int width;
	int height;
	ImageData() {
		spriteIndex = -1;
		colorIndex = -1;
	}
  };


class Sprite
{
public:
	Sprite(void);
	virtual ~Sprite(void);

	bool loadSprite(LPDIRECT3DDEVICE9 device, std::string filename);
	void loadSpriteFromBuffer(LPDIRECT3DDEVICE9 device, char buf[], int bufsize);

	void render(LPDIRECT3DDEVICE9 pDevice, D3DCOLOR color, int alpha);
	void setPosition(int x, int y);
	void setSize(int newWidth, int newHeight);


	int getHeight();
	int getWidth();

//private:
	bool textureLoaded;
	LPD3DXSPRITE sprite;
	LPDIRECT3DTEXTURE9 texture;
	D3DXVECTOR3 position;
	D3DXVECTOR3 scale;

	float width;
	float height;
	//RECT rectSrc;
	//RECT rectDest;
};
